/*      Copyright 2002 Arizona Board of regents on behalf of 
 *                  The University of Arizona 
 *                     All Rights Reserved 
 *         (USE & RESTRICTION - Please read COPYRIGHT file) 
 * 
 *  Version    : DEVSJAVA 2.7 
 *  Date       : 08-15-02 
 */ 


package SimpArc;

import java.awt.*;
import java.util.*;
import simView.*;
import genDevs.modeling.*;
import genDevs.simulation.*;
import GenCol.*;

public class multiServer extends ViewableDigraph{



public multiServer() {this("multi", 200, 2);}

public multiServer(String name,double proc_time,int size)
{
 super(name);
 make(proc_time,size);
 addTestInput("in", new entity("job"));
}


 private void make(double proc_time,int size){

    addInport("in");
    addOutport("out");

    multiServerCoord  co  = new multiServerCoord("MultiSco");
   add(co);

 for (int i = 1; i <= size; i++){
     proc  p = new procName("proc" + i, proc_time);
    add(p);
   co.add_procs(p);
    p.setPreferredLocation(new Point(187, 22 + 80 * (i - 1)));

  }

    Iterator i = getComponents().iterator();
    while (i.hasNext()) {
       entity ent = (entity)i.next();
       devs comp = (devs)ent;
   if (!ent.equals(co))
  {
    addCoupling(co, "y", comp,"inName"); //use name for routing
    addCoupling(comp,"outName",co,"x");
  }

  }
    addCoupling(this,"in",co,"in");
    addCoupling(co,"out",this,"out");


initialize();

    preferredSize = new Dimension(508, 32 + 80 * size);
    co.setPreferredLocation(new Point(-7, 20));
}

    /**
     * Automatically generated by the SimView program.
     * Do not edit this manually, as such changes will get overwritten.
     */
    public void layoutForSimView()
    {
        preferredSize = new Dimension(663, 311);
        ((ViewableComponent)withName("proc1")).setPreferredLocation(new Point(27, 196));
        ((ViewableComponent)withName("proc2")).setPreferredLocation(new Point(388, 175));
        ((ViewableComponent)withName("proc3")).setPreferredLocation(new Point(187, 182));
        ((ViewableComponent)withName("MultiSco")).setPreferredLocation(new Point(164, 38));
    }
}
